//
//  NSString+Size.m
//  BossSystem
//
//  Created by hzyd-wlj on 14-8-19.
//  Copyright (c) 2014年 hzyd. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NSString+Size.h"

@implementation NSString (Size)
- (CGSize)rj_sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)constrainedSize
{
    if ([self respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
        CGRect rect =  [self boundingRectWithSize:constrainedSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:NULL];
        return rect.size;
    }else{
        return [self sizeWithFont:font constrainedToSize:constrainedSize lineBreakMode:NSLineBreakByCharWrapping];
    }
}
@end
